import axios from 'axios';
import qs from 'query-string';
import {
  WxMaCodeVersionAddCmd,
  WxMaCodeVersionListQry,
  WxMaCodeVersionUptCmd,
  WxMaCodeVersionView,
} from '@/types/third/wx-ma-code-version';

export function fetchWxMaCodeVersionList(params: WxMaCodeVersionListQry) {
  return axios.get<WxMaCodeVersionView[]>('/third/wx/ma-code-version/list', {
    params,
    paramsSerializer: (obj) => {
      return qs.stringify(obj);
    },
  });
}

export function createWxMaCodeVersion(data: WxMaCodeVersionAddCmd) {
  return axios.post('/third/wx/ma-code-version', data);
}

export function updateWxMaCodeVersion(data: WxMaCodeVersionUptCmd) {
  return axios.put('/third/wx/ma-code-version', data);
}
